<!doctype html>
<html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
%>
<head>
    <meta charset="UTF-8">
    <title>后台管理</title>
    <link rel="stylesheet" type="text/css" href="css/common.css"/>
    <link rel="stylesheet" type="text/css" href="css/main.css"/>
    <script type="text/javascript" src="js/libs/modernizr.min.js"></script>
    <jsp:include page="/manage/inc/header"></jsp:include>
</head>
<body>

<!--/sidebar-->
<div class="main-wrap">

    <div class="result-content" id="show">

    </div>
    </form>
</div>
</div>
<!--/main-->
</div>
</body>
<jsp:include page="/manage/inc/footer"></jsp:include>
<script>

    $(function () {
        initData(1);
        $("#show").on("change",".result-list select",function () {
            var id = $(this).val();
            var action = "<%=path%>/manage/task/ajaxJsp/listByMark"
            $.post(action,{id:id},function (mes) {
                $("#show").html(mes)
            })
        })
    })
    function initData(pageNum) {
        var action = "<%=path%>/manage/task/list";
        $.post(action, {pageNum: pageNum}, function (mes) {
            $("#show").html(mes)
        })
    }
    $(function () {
        $("#show").on("click",".list",function () {
            var pageNum = $(this).data("id");
            initData(pageNum);
        })
    })
    //任务提交列表
    $(function () {
        $("#show").on("click","#count",function () {
            var action = "<%=path%>/manage/task/ajaxJsp/taskPass"
            $.post(action,function (mes) {
                $("#show").html(mes)
            })
        })
    })

    $(function () {
        $("#show").on("click","#finish",function () {
            var action = "<%=path%>/manage/task/ajaxJsp/finishPass"
            $.post(action,function (mes) {
                $("#show").html(mes)
            })
        })
    })
    //通过
   $(function () {
       $("#show").on("click",".reject",function () {
           var id = $(this).data("id");
           var action = "<%=path%>/manage/task/closure"
           $.post(action,{id:id})
       })
   })


//通过
    $(function () {
        $("#show").on("click",".pass",function () {
            var id = $(this).data("id")
            layer.confirm("确认通过审核吗",function () {
                var action = "<%=path%>/manage/task/deblocking"
                $.post(action,{id:id},function (mes) {
                    layer.msg("通过完成")
                    $("tr[id=tr"+id+"]").remove();
                })
            })
        })
    })

    $(function () {
        $("#show").on("click",".finishpass",function () {
            var id = $(this).data("id")
            alert(id)
            layer.confirm("确认通过审核吗",function () {
                var action = "<%=path%>/manage/task/Finshdeblocking"
                $.post(action,{id:id},function (mes) {
                    layer.msg("通过完成")
                    $("tr[id=tr"+id+"]").remove();
                })
            })
        })
    })

    //驳回
    $(function () {
        $("#show").on("click",".finishreject",function () {
            var id = $(this).data("id")
            layer.prompt({
                formType: 2,
                title: '请输入驳回理由'
            }, function(value, index, elem){
                var action= "<%=path%>/manage/task/Reason";
                var reason = value;
                $.post(action,{reason:reason,id:id},function () {
                    layer.close(index);
                    layer.confirm("确认驳回此申请吗",function () {
                        var url="<%=path%>/manage/task/Finshclosure";
                        $.post(url,{id:id},function (mes) {
                            layer.msg("申请已驳回")
                            $("tr[id=tr"+id+"]").remove();
                        })
                    })
                })

            });
        })
    })



    //驳回
    $(function () {
        $("#show").on("click",".reject",function () {
            var id = $(this).data("id")
            layer.prompt({
                formType: 2,
                title: '请输入驳回理由'
            }, function(value, index, elem){
                var action= "<%=path%>/manage/task/Reason";
                var reason = value;
                $.post(action,{reason:reason,id:id},function () {
                    layer.close(index);
                    layer.confirm("确认驳回此申请吗",function () {
                        var url="<%=path%>/manage/task/Finshclosure";
                        $.post(url,{id:id},function (mes) {
                            layer.msg("申请已驳回")
                            $("tr[id=tr"+id+"]").remove();
                        })
                    })
                })

            });
        })
    })
</script>
</html>
